package com.healthdata.controller;

import com.healthdata.service.BedUtilizationService;
import com.healthdata.vo.BedUtilizationVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/bed-utilization")
public class BedUtilizationController {

    @Autowired
    private BedUtilizationService bedUtilizationService;

    /**
     * 查询所有床位利用情况
     */
    @GetMapping("/list")
    public List<BedUtilizationVO> listAll() {
        return bedUtilizationService.listAll();
    }

    /**
     * 根据ID查询床位利用情况
     */
    @GetMapping("/{id}")
    public BedUtilizationVO getById(@PathVariable Integer id) {
        return bedUtilizationService.getById(id);
    }

    /**
     * 根据机构类型查询床位利用情况
     */
    @GetMapping("/list-by-type")
    public List<BedUtilizationVO> listByType(@RequestParam String institutionType) {
        return bedUtilizationService.listByInstitutionType(institutionType);
    }

    /**
     * 根据年份查询床位利用情况
     */
    @GetMapping("/list-by-year")
    public List<BedUtilizationVO> listByYear(@RequestParam Integer year) {
        return bedUtilizationService.listByYear(year);
    }
}